﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using ORM.Common.DataAnnotations;
using ORM.Resources;

namespace ORM.Business.Models.Entities
{
    public class Answer
    {
        #region Primitive properties

        public int Id { get; set; }
        public int QuestionId { get; set; }

        [RequiredExtended]
        [StringLengthExtended(4000)]
        [AllowHtml]
        public string ContentHtml { get; set; }
        public string ContentText { get; set; }

        public int UpVotes { get; set; }
        public int DownVotes { get; set; }
        public int Reports { get; set; }

        [Column("PostedBy")]
        public int PostedById { get; set; }

        public DateTime PostedDate { get; set; }

        [Column("UpdatedBy")]
        public int? UpdatedById { get; set; }

        public DateTime? LastUpdate { get; set; }
        public bool IsAccepted { get; set; }
        public bool IsDeleted { get; set; }
        public bool IsApproved { get; set; }
        public bool IsReadByQuestioner { get; set; }
        [NotMapped]
        public virtual bool IsVotedByCurrentUser { get; set; }
        [NotMapped]
        public virtual bool Highlight { get; set; }


        #endregion

        #region Navigation properties

        [ForeignKey("QuestionId")]
        public virtual Question Question { get; set; }

        [ForeignKey("PostedById")]
        public virtual user PostedBy { get; set; }

        [ForeignKey("UpdatedById")]
        public virtual user UpdatedBy { get; set; }


        #endregion
    }
}